Skip to content

[Bridges] fix deleting variable in bridged objective#2150

Merged
odow merged 7 commits into
masterfrom
od/fix-bridge-delete
Apr 25, 2023
Merged

[Bridges] fix deleting variable in bridged objective#2150
odow merged 7 commits into
masterfrom
od/fix-bridge-delete

Conversation

@odow

@odow odow commented Apr 19, 2023

Copy link
Copy Markdown
Member

Some solvers error getting ObjectiveFunctionType if objective is not set. (x-ref jump-dev/CPLEX.jl#433)

I need to manually test this with CPLEX and Gurobi:

odow and others added 3 commits April 20, 2023 19:40
Some solvers error getting ObjectiveFunctionType if objective is not set.
@odow
odow force-pushed the od/fix-bridge-delete branch from c579d1d to 495036c Compare April 20, 2023 07:40
@odow
odow requested a review from blegat April 20, 2023 08:08
@odow

odow commented Apr 20, 2023

Copy link
Copy Markdown
Member Author

@blegat can you take a look? This is fairly urgent because it broke tests for CPLEX and Gurobi

Comment thread src/Bridges/bridge_optimizer.jl

@blegat blegat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment is optional

::Vector{MOI.VariableIndex},
::Type{F},
) where {F}
# Nothing to do here. The variables can be deleted without changing the type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppose the objective is a quadratic function that is bridged with Objective.Slack and then Constraint.QuadtoSOC, we should still update the function so that the corresponding SOC constraint is updated.
This can be done in a separate PR though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that happens automatically. This is just a special case where deleting a variable can unset the objective, rather than just modify the existing function.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it does. I think the variable deletion API kind of assumes that all bridges are affine so since the deletion commutes with affine operations then it's fine to skip the bridges and delete the solver model directly but there is one notable exception which is the QuadtoSOC bridge. We should maybe check but it's best we open a separate issue

Comment thread docs/src/changelog.md Outdated
@odow
odow merged commit 6954608 into master Apr 25, 2023
@odow
odow deleted the od/fix-bridge-delete branch April 25, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants